<template>
	<view>
		<view>
			<uni-nav-bar shadow left-icon="left" dark title="供应商报价" @clickLeft="back()" />
		</view>
		<view>
			<uni-segmented-control :current="current" :values="items" styleType="button" activeColor="#ffaa00" @clickItem="onClickItem" style="background-color: #fff"  />
		</view>
		<view>
			<view v-if="current === 0">
				<view v-for="(item,index) in from" :key="index">
				<uni-card>
				<uni-row><text style="font-weight: 600;">编码:</text>{{item.code}}</uni-row>
				<uni-row><text style="font-weight: 600;">编号:</text>{{item.number}}</uni-row>
				<uni-row><text style="font-weight: 600;">询价单标题:</text>{{item.inquiryTitle}}</uni-row>
				<uni-row><text style="font-weight: 600;">询价方式:</text>{{item.inquiryWay}}</uni-row>
				<uni-row><text style="font-weight: 600;">税率:</text>{{item.tax}}%</uni-row>
				<uni-row><text style="font-weight: 600;">供应商名称:</text>{{item.supplierName}}</uni-row>
				<uni-row><text style="font-weight: 600;">项目类型:</text>{{item.projectType}}</uni-row>
				<uni-row><text style="font-weight: 600;">采购员名称:</text>{{item.purchaserName}}</uni-row>
				<uni-row><text style="font-weight: 600;">截止时间:</text>{{item.deadline}}</uni-row>
				<uni-row><text style="font-weight: 600;">发布时间:</text>{{item.releaseTime}}</uni-row>
				<uni-row v-if="item.quotationStatus==1"><text style="font-weight: 600;">报价参与状态:</text><text style="background-color: gold;border-radius:10rpx;color:#fff;">未参与</text></uni-row>
			    <view style="text-align: center;"><button type="warn" size="mini" @click="supplierDetailNo(from[index])">查看</button></view>   
					</uni-card>		  	
				</view>
			</view>
			
			<view v-if="current === 1">
					<view v-for="(item,index) in froms" :key="index">
					<uni-card>
					<uni-row><text style="font-weight: 600;">编码:</text>{{item.code}}</uni-row>
					<uni-row><text style="font-weight: 600;">编号:</text>{{item.number}}</uni-row>
					<uni-row><text style="font-weight: 600;">询价单标题:</text>{{item.inquiryTitle}}</uni-row>
					<uni-row><text style="font-weight: 600;">询价方式:</text>{{item.inquiryWay}}</uni-row>
	<uni-row><text style="font-weight: 600;">税率:</text>{{item.tax}}%</uni-row>
	<uni-row><text style="font-weight: 600;">供应商名称:</text>{{item.supplierName}}</uni-row>
					<uni-row><text style="font-weight: 600;">项目类型:</text>{{item.projectType}}</uni-row>
					<uni-row><text style="font-weight: 600;">采购员名称:</text>{{item.purchaserName}}</uni-row>
					<uni-row><text style="font-weight: 600;">截止时间:</text>{{item.deadline}}</uni-row>
					<uni-row><text style="font-weight: 600;">发布时间:</text>{{item.releaseTime}}</uni-row>
					<uni-row v-if="item.quotationStatus==2"><text style="font-weight: 600;">报价参与状态:</text><text style="background-color: gold;border-radius:10rpx;color:#fff;">参与中</text></uni-row>
					<view style="text-align: center;"><button type="warn" size="mini" @click="supplierDetail(froms[index])">查看</button></view>
					</uni-card>		  	
					</view>
			</view>
		</view>
		
		
	</view>
</template>

<script>
	import {QuotationFormDatatable} from "@/api/system/user"
	export default {
		data() {
			return {
			 current:0,
			 from:null,
			 QuotationForm:{
				page: 1,
				rows:100,
				quotationStatus:null,
				
			 },
			 items: ['未参与询价单', '报价中询价单'],	
			}
		},
		onLoad() {
		 this.get()	
		 this.gets()
		},
		methods: {
			
			
			get(){
				this.QuotationForm.quotationStatus='1'
				QuotationFormDatatable(this.QuotationForm).then(res=>{
					this.from =res.rows
				})
				
			},
			gets(){
				this.QuotationForm.quotationStatus='2'
				
				QuotationFormDatatable(this.QuotationForm).then(res=>{
					this.froms =res.rows
				})
				
			},
			
		back(){
				this.$tab.reLaunch('/pages/work/supplier/index')
		},
		supplierDetailNo(e){
			
			uni.navigateTo({
			       url: '/pages/work/supplier/supplier_inquiry_detail',
			       success: (respost) => {
			           // 通过eventChannel向被打开页面传送数据
			           respost.eventChannel.emit('acceptDataFromOpenerPage', {data:e},
					   )}
			     });
	
		},
		//往已参与信息传值
		supplierDetail(e){
			uni.navigateTo({
			       url: '/pages/work/supplier/supplier_inquiry_page_list',
			       success: (respost) => {
			           // 通过eventChannel向被打开页面传送数据
			           respost.eventChannel.emit('acceptDataFromOpenerPage', {data:e},
					   )}
			     });
		},
		
		onClickItem(e) {
					if (this.current !== e.currentIndex) {
						this.current = e.currentIndex
					}
				},
		}
	}
</script>

<style>

</style>
<text></text>